Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(etdump): Add FileDataSink test coverage #9332

Merged

Conversation

Megan0704-1
Copy link
Contributor

test(etdump): Add FileDataSink test coverage

Summary

Adds test validation for FileDataSink usage in ETDumpGen scenarios. Extends existing debug event tests to cover file-based data sinks.

Test Plan

Build & Run Tests:

# From build directory (cmake-out)
make -j32
ctest -R sdk_etdump_tests --output-on-failure

Fixes #9165

Copy link

pytorch-bot bot commented Mar 17, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/9332

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 8e8c978 with merge base 8c32da7 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 17, 2025
@Megan0704-1
Copy link
Contributor Author

@pytorchbot label "topic: not user facing"

@@ -233,5 +235,5 @@ install(

if(BUILD_TESTING)
# TODO: This is currently not working!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have brought the test building back, plz remove this comment

@@ -45,16 +49,23 @@ class ProfilerETDumpTest : public ::testing::Test {
const size_t buf_size = 512 * 1024;
buf = (uint8_t*)malloc(buf_size * sizeof(uint8_t));
etdump_gen[1] = new ETDumpGen(Span<uint8_t>(buf, buf_size));

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if you can use the temp file et provided. You can find example here: https://github.com/pytorch/executorch/blob/main/extension/data_loader/test/file_data_loader_test.cpp#L15

Or is there any reason why you didn't choose that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback!!

@Gasoonjia
Copy link
Contributor

@Megan0704-1 thanks for taking this task! Overall looks great and left some comments. Also some of the cis are broken.

root and others added 2 commits March 18, 2025 19:29
Summary:
- Extend test loops to cover FileDataSink scenarios (j=2 case)
- Add temporary file cleanup in TearDown
- Include file_data_sink.h, stdio.h and fstream in test sources
- Update CMakeLists.txt to ensure proper linking

Fixes pytorch#9165
- Migrate from tmpnam to executorch::extension::testing::TempFile
  for secure temporary file handling
- Add missing namespace qualification for TempFile class
- Use std::unique_ptr for proper RAII management
- Remove manual file deletion since TempFile handles cleanup
- Remove building sdk_etdump_test in devtools/CMakeLists.txt
@Megan0704-1 Megan0704-1 force-pushed the etdump-file-data-sink-test-coverage branch from 59edeea to 8e8c978 Compare March 18, 2025 19:30
@Gasoonjia
Copy link
Contributor

Gasoonjia commented Mar 18, 2025

@Megan0704-1 LGTM! Thanks for your contribution! I will stamp it after cis are passed.
Also, If you like you can join our discord and directly ping us or left message to broader group https://github.com/pytorch/executorch?tab=readme-ov-file#contributing

@Gasoonjia Gasoonjia merged commit d46623e into pytorch:main Mar 19, 2025
80 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. topic: not user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing FileDataSink test in etdump_flatcc tests
3 participants